package com.ittony.mapper;

import com.github.pagehelper.Page;
import com.ittony.annotation.AutoFill;
import com.ittony.entity.SetMeal;
import com.ittony.enumeration.OperationType;
import com.ittony.vo.DishItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetMealMapper {

    Integer countByCategoryId(@Param("categoryId") Long categoryId);

    List<SetMeal> listByCategoryId(SetMeal setMeal);

    @AutoFill(OperationType.UPDATE)
    void update(SetMeal setMeal);

    @Select("select sd.name, sd.copies, d.image, d.description " + "from setmeal_dish sd left join dish d on sd.dish_id = d.id " + "where sd.setmeal_id = #{setmealId}")
    List<DishItemVO> getDishItemBySetmealId(Long id);

    Integer countByMap(Map map);
}
